package com.admin.index.controller;

import java.util.List;

import com.admin.index.service.AdIndexService;
import com.interceptor.AdLoginInterceptor;
import com.jfinal.aop.Before;
import com.jfinal.core.Controller;
import com.jfinal.plugin.activerecord.Db;
import com.vo.Employees;
import com.vo.Navigation;

@Before(AdLoginInterceptor.class)
public class AdIndexController extends Controller {
	public void index() {
		Employees employee = getSessionAttr("adminsession");
		List<Navigation> navlist = AdIndexService.service.getNavi(employee
				.getInt("powerid"));
		setAttr("navlist", navlist);
		setAttr("employee", employee);
		renderJsp("/WEB-INF/admin/index.jsp");
	}

	public void getRefundcount() {
		StringBuffer sql = new StringBuffer();
		sql.append("SELECT COUNT(*) FROM refund r WHERE r.refund_state=2");
		long l = Db.queryLong(sql.toString());
		renderJson(l);
	}
}